import 'package:cbec_app/generated/json/base/json_convert_content.dart';
import 'package:cbec_app/pages/member/entity/havelist_info_entity.dart';
import 'package:cbec_app/pages/member/entity/vip_card_item_entity.dart';

HavelistInfoEntity $HavelistInfoEntityFromJson(Map<String, dynamic> json) {
  final HavelistInfoEntity havelistInfoEntity = HavelistInfoEntity();
  final double? money = jsonConvert.convert<double>(json['money']);
  if (money != null) {
    havelistInfoEntity.money = money;
  }
  final List<VipCardItemEntity>? card = (json['card'] as List<dynamic>?)?.map((e) => jsonConvert.convert<VipCardItemEntity>(e) as VipCardItemEntity).toList();
  if (card != null) {
    havelistInfoEntity.card = card;
  }
  return havelistInfoEntity;
}

Map<String, dynamic> $HavelistInfoEntityToJson(HavelistInfoEntity entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['money'] = entity.money;
  data['card'] = entity.card?.map((v) => v.toJson()).toList();
  return data;
}

extension HavelistInfoEntityExtension on HavelistInfoEntity {
  HavelistInfoEntity copyWith({
    double? money,
    List<VipCardItemEntity>? card,
  }) {
    return HavelistInfoEntity()
      ..money = money ?? this.money
      ..card = card ?? this.card;
  }
}
